﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using CommonTagTime.Business;
using CommonTagTime.ModelObject;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.Security;
/// <summary>
/// Summary description for Util
/// </summary>
/// 
namespace WebUtil
{
    public class Common
    {
        public static int LocationThietKe = 1;
        public static void BindLocation(DropDownList drl, bool addNull)
        {
            busLocation _busLocation = new busLocation();
            LocationCollection lstLocation = _busLocation.GetAll();
            drl.Items.Clear();
            drl.Items.Add(new ListItem("- - -", ""));
            foreach (Location objLocation in lstLocation)
            {
                drl.Items.Add(new ListItem(objLocation.Name, objLocation.LocationId.ToString()));
            }

        }
        public static void BindShift(DropDownList drl, bool addNull)
        {
            busShift _busShift = new busShift();
            ShiftCollection lstData = _busShift.GetAll();
            drl.Items.Clear();
            drl.Items.Add(new ListItem("- - -", ""));
            foreach (Shift obj in lstData)
            {
                drl.Items.Add(new ListItem(obj.Name, obj.ShiftId.ToString()));
            }

        }
        public static void BindUSer(DropDownList drl, bool addNull)
        {
            MembershipUserCollection lstUser = Membership.GetAllUsers();          
            drl.Items.Clear();
            drl.Items.Add(new ListItem("- - -", ""));
            foreach (MembershipUser obj in lstUser)
            {
                drl.Items.Add(new ListItem(obj.UserName, obj.ProviderUserKey.ToString()));
            }

        }
    }
}
